home *** CD-ROM | disk | FTP | other *** search
- package com.sun.java.swing.plaf.basic;
-
- import com.sun.java.swing.AbstractAction;
- import java.awt.event.ActionEvent;
- import java.io.Serializable;
-
- class BasicTreeUI$TreeTraverseAction extends AbstractAction implements Serializable {
- // $FF: synthetic field
- BasicTreeUI this$0;
- private int direction;
-
- // $FF: synthetic method
- public BasicTreeUI$TreeTraverseAction(BasicTreeUI this$0, int direction, String name) {
- super(name);
- this.this$0 = this$0;
- this.direction = direction;
- }
-
- public void actionPerformed(ActionEvent e) {
- int rowCount;
- if (this.this$0.tree != null && (rowCount = this.this$0.getRowCount()) > 0) {
- int minSelIndex = this.this$0.tree.getMinSelectionRow();
- int newIndex;
- if (minSelIndex == -1) {
- newIndex = 0;
- } else if (this.direction == 1) {
- if (!this.this$0.isLeaf(minSelIndex) && !this.this$0.isExpanded(minSelIndex)) {
- this.this$0.expandRow(minSelIndex);
- newIndex = -1;
- } else {
- newIndex = Math.min(minSelIndex + 1, rowCount - 1);
- }
- } else if (!this.this$0.isLeaf(minSelIndex) && this.this$0.isExpanded(minSelIndex)) {
- this.this$0.collapseRow(minSelIndex);
- newIndex = -1;
- } else {
- try {
- if (!this.this$0.largeModel) {
- newIndex = ((VisibleTreeNode)this.this$0.getNode(minSelIndex).getParent()).getRow();
- } else {
- int[] cIndex = new int[1];
- LargeTreeModelNode parent = this.this$0.getLargeParentAndChildIndexOfRow(minSelIndex, cIndex);
- newIndex = parent.getRow();
- }
- } catch (Exception var7) {
- newIndex = -1;
- }
- }
-
- if (newIndex != -1) {
- this.this$0.tree.setSelectionInterval(newIndex, newIndex);
- this.this$0.ensureRowsAreVisible(newIndex, newIndex);
- }
- }
-
- }
-
- public boolean isEnabled() {
- return this.this$0.tree != null && this.this$0.tree.isEnabled();
- }
- }
-